#include<bits/stdc++.h>
using namespace std;
const int N=10;
int arr[30]; 
int b[N][N];
int check(){
	int pos=0,s3=0,s4=0;
	for (int i=1;i<=5;i++)
		for(int j=1;j<=5;j++)b[i][j]=arr[++pos];
	
	for (int i=1;i<=5;i++){
		int s1=0,s2=0;
		for (int j=1;j<=5;j++){
			s1+=b[i][j];
			s2+=b[j][i];
			if (i-j==0)s3+=b[i][j];
			if (j+i==6)s4+=b[i][j]; 
		}
		if (s1==0 || s1==5 || s2==0 || s2==5)return 0;
	}
	if (s3==0 || s3==5 || s4==0 || s4==5)return 0;
	return 1;
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int ans=0;
	for (int i=0;i<=(1<<25)-1;i++){
		int s=0;
		for (int j=0;j<25;j++){
			arr[j+1]=(i>>j)&1;
			if (i>>j&1)s++;
		}
		if (s!=13)continue; 
		if(check())ans++;
	}
	cout<<ans;
	return 0; 
} 
